<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>&nbsp;boxphp后台管理系统</title>
<link rel="shortcut icon" href="__AdminImages__/favicon.ico" type="image/x-icon" />
<link type="text/css" rel="stylesheet" href="__AdminCss__/slyle.css" />
<link type="text/css" rel="stylesheet" href="__AdminCss__/login.css" />
<script type="text/javascript" src="__JS__/jquery-2.1.4.min.js"></script>
<style type="text/css">
  #msg{
    margin-left: 20px;
    color:red;
    font-weight: bold;
  }
</style>
<script>      
function reloadcode(){
    var url = '<{:U('Login/verify')}>';
    $("#code").attr("src", url + '/' + Math.random());
}
$(function(){
    $("#subbtnSibmit").submit(function(){
        var username = $("#user").val();
        var password = $("#pass").val();
        var code = $("#vcode").val();
        var check =$('input[name="check"]:checked').val();
        if(username == ''){
           $("#msg").html('请输入用户名!');
           $("#user").focus();
           return false;
        }
        if(password == ''){
           $("#msg").html('请输入密码!');
           $("#pass").focus();
           return false;
        }
        if(code == ''){
            $("#msg").html('请输入验证码!');
           $("#vcode").focus();
           return false;
        }
        $.ajax({
            type: "GET",
            url: "<{:U('Login/login_do')}>",
            dataType: "json",
            data: {"username":username,"password":password,"code":code,"check":check},
            success: function(json){
                 if(json.success==1){
                     $("#msg").html('用户名或密码错误!');
                     reloadcode();
                     $("#user").focus();
                 }else if(json.success==2){
                     $("#msg").html('验证码错误!');
                     reloadcode();
                     $("#vcode").focus(); 
                 }else if (json.success==3){
                     window.location.href='<{:U("Index/index")}>';
                 }else if(json.success==4){
                     $("#msg").html('用户名或密码错误!');
                     reloadcode();
                     $("#user").focus();
                 }else if(json.success==5){
                     $("#msg").html('验证码错误!');
                     reloadcode();
                     $("#vcode").focus(); 
                 }else if(json.success==7){
                     $("#msg").html('用户已被锁定!');
                     reloadcode();
                     $("#user").focus();
                 }else if(json.success==6){
                    window.location.href='<{:U("Index/index")}>';
                 }
            } 
        })
       return false;
    })
   
})     
</script>
</head>

<body>

<div class="login">
		<div class="tit" style="color:#fff">后台管理管理系统</div>
		<form id="subbtnSibmit" method="post">
		<input type="hidden" name="im_seller" value="true">
		<div class="cont">
			<div class="inputbr">
				<label for="textfield">用户名</label>
				<input type="text"  name="username"  id="user" value="<{$Think.cookie.username}>"><span class="user_info"  ></span>
			</div>
			<div class="inputbr2">
				<label for="textfield2">密<span>&nbsp;&nbsp;</span>码</label>
				<input type="password" name="password"  id="pass" value="<{$Think.cookie.password}>" ><span class="pass_info"  ></span>
			</div>
				 <div class="inputbr" style="position:relative;width: 288px;overflow: hidden;">
				<label for="textfield2">验证码</label>
				 <input type="text"  name="code" id="vcode"  />
          <img onclick="reloadcode()" id="code" class="vm" src="__URL__/verify" style="position:absolute; z-index:99; top:-5px; left:-60px; " />
            <span class="code_info"  ></span>
			</div>
			
			<div><input type="submit" value="马上登录"></div>
			<div id="msg" style="line-height:40px; text-align:center"></div>
		</div>
		</form>
	</div>
	<div class="foot">&copy;后台管理 版权所有</div>



</body>
</html>
